Skip to content

Conversation

@tophroxx
Copy link

@tophroxx tophroxx commented Jan 28, 2026

This fixes window animation speeds and smoothing on different display resolutions. Closes #2130

I've made a quick video showcasing new behavior and retail behavior side-by-side. Unfortunately it was too big for GitHub, so i uploaded it to YouTube.

https://youtu.be/wDQdis7Z1L4

Pay attention to how fast the control bar slides from the bottom when i'm loading into a match, and also how fast the diplomacy screen slides from the top.

This PR adds 2 new methods to the Display class local helper functions and changes 4 children of the ProcessAnimateWindow class - SlideFromLeft, SlideFromRight, SlideFromTop and SlideFromBottom, making them benefit from these new methods.
It also moves velocity and slowdown threshold initialization from the constructor into initAnimateWindow, which means that these values will scale properly even if user changes their resolution in runtime.
I've made little changes to minimize the possibility of new issues appearing while still fixing the issue.

@greptile-apps
Copy link

greptile-apps bot commented Jan 28, 2026

Greptile Overview

Greptile Summary

Scaled window animation velocities and slowdown thresholds to match display resolution, fixing animations running too fast on higher resolutions.

  • Added getDisplayWidthScaler() and getDisplayHeightScaler() helper functions that calculate scaling ratios based on DEFAULT_DISPLAY_WIDTH (800) and DEFAULT_DISPLAY_HEIGHT (600)
  • Modified four animation classes (SlideFromRight, SlideFromLeft, SlideFromTop, SlideFromBottom) to apply scaling in initAnimateWindow()
  • Moved velocity and threshold initialization from constructors into initAnimateWindow() to support runtime resolution changes
  • Applied identical changes to both Generals (vanilla) and GeneralsMD (Zero Hour) codebases

Confidence Score: 5/5

  • Safe to merge - well-implemented fix with minimal risk
  • The implementation follows existing codebase patterns for resolution scaling, correctly applies separate width/height scalers to horizontal/vertical animations, properly moves initialization to support runtime resolution changes, and has already been validated with video demonstration
  • No files require special attention

Important Files Changed

Filename Overview
Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp Added resolution scaling to window animation velocities and thresholds
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp Added resolution scaling to window animation velocities and thresholds (identical to Generals)

Sequence Diagram

sequenceDiagram
    participant Constructor
    participant initAnimateWindow
    participant Helper as getDisplayWidthScaler()<br/>getDisplayHeightScaler()
    participant Display as TheDisplay
    participant updateAnimateWindow

    Note over Constructor: Constructor called
    Constructor->>Constructor: Set m_maxVel = 0.0f
    Constructor->>Constructor: Set m_slowDownThreshold = 0

    Note over initAnimateWindow: Animation initialized
    initAnimateWindow->>Helper: Call scaler function
    Helper->>Display: getWidth()/getHeight()
    Display-->>Helper: Current resolution
    Helper-->>initAnimateWindow: resolution / DEFAULT_DISPLAY (800x600)
    initAnimateWindow->>initAnimateWindow: m_maxVel *= scaler
    initAnimateWindow->>initAnimateWindow: m_slowDownThreshold *= scaler

    Note over updateAnimateWindow: Animation updates each frame
    updateAnimateWindow->>updateAnimateWindow: Use scaled m_maxVel
    updateAnimateWindow->>updateAnimateWindow: Compare against scaled threshold
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@xezon xezon added Bug Something is not working right, typically is user facing GUI For graphical user interface Minor Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour labels Jan 29, 2026
@tophroxx
Copy link
Author

Done all requested changes and replicated the fix for vanilla Generals. Works there as well.

@tophroxx tophroxx requested a review from xezon January 31, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Gen Relates to Generals GUI For graphical user interface Minor Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Diplomacy screen slow to open/close at high resolution

2 participants